package com.ls.fw.maven;

import java.io.File;
import java.io.IOException;

public class MvnInstall
  extends BaseMvn
{
  public MvnInstall(String jafPath)
  {
    super(jafPath);
  }
  
  public static void main(String[] args)
    throws IOException
  {
    String jarName = "../lib/";
    if ((args != null) && 
      (args.length > 0)) {
      jarName = args[0];
    }
    File file = new File(jarName);
    MvnInstall f = new MvnInstall(file.getCanonicalPath());
    f.exe();
  }
  
  public void exe(BaseMvn.POM pom)
  {
    StringBuilder sb = new StringBuilder();
    sb.append("cmd /r mvn install:install-file ");
    sb.append(getCommonOrder(pom));
    Runtime runtime = Runtime.getRuntime();
    try
    {
      System.out.println("执行命令：" + sb.toString());
      runtime.exec("cmd");
      runtime.exec(sb.toString());
    }
    catch (Exception e)
    {
      e.printStackTrace();
    }
  }
}
